using System.Text.RegularExpressions;
using MalwareMultiScan.Backends.Backends.Abstracts;
using MalwareMultiScan.Backends.Services.Interfaces;

namespace MalwareMultiScan.Backends.Backends.Implementations
{
    /// <inheritdoc />
    public class KesScanBackend : AbstractLocalProcessScanBackend
    {
        /// <inheritdoc />
        public KesScanBackend(IProcessRunner processRunner) : base(processRunner)
        {
        }

        /// <inheritdoc />
        public override string Id { get; } = "kes";

        /// <inheritdoc />
        protected override string BackendPath { get; } = "/bin/bash";

        /// <inheritdoc />
        protected override Regex MatchRegex { get; } =
            new Regex(@"[ +]DetectName.*: (?<threat>.*)", RegexOptions.Compiled | RegexOptions.Multiline);

        /// <inheritdoc />
        protected override string GetBackendArguments(string path)
        {
            return $"/usr/bin/kesl-scan {path}";
        }
    }
}